package com.iamteer.factory;

import java.util.ResourceBundle;

/**
 * 生成 Service 实例的工厂方法
 * @author Chuck
 *
 */
public class BeanFactory {
	private static ResourceBundle bundle;
	static {
		bundle = ResourceBundle.getBundle("instance");
	}
	public static <T> T getInstance(String key, Class<T> clazz) {
		try {
			String className = bundle.getString(key);
			return (T)Class.forName(className).newInstance();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
}
